package com.twohand.admin.Controller;

import com.twohand.admin.Dto.QrcodeListQueryDto;
import com.twohand.admin.Entity.Qrcode;
import com.twohand.admin.Service.QrcodeService;
import com.twohand.admin.Util.PageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/qrcode")
public class QrcodeController {
    @Autowired
    QrcodeService qrcodeService;
    @GetMapping
    PageResponse<Qrcode> getAllSales(QrcodeListQueryDto qrcodeListQueryDto){
        return qrcodeService.qrcodeList(qrcodeListQueryDto);
    }
    @PostMapping
    Boolean addSales(@RequestBody Qrcode qrcode){
        return qrcodeService.addQrcode(qrcode);
    }
    @PutMapping
    Boolean changeSales(@RequestBody Qrcode qrcode){
        return qrcodeService.changeQrcode(qrcode);
    }
    @DeleteMapping("/{id}")
    Boolean delSales(@PathVariable Integer id){
        return  qrcodeService.delQrcode(id);
    }
    @GetMapping("/setDefault")
    Boolean setDefault(Integer id){
        return qrcodeService.setDefault(id);
    }
}
